package com.ruoyi.project.jxy.service.impl;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.jxy.domain.Entry;
import com.ruoyi.project.jxy.mapper.EntryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.project.jxy.mapper.EntityMapper;
import com.ruoyi.project.jxy.domain.Entity;
import com.ruoyi.project.jxy.service.IEntityService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 实体与辅助词Service业务层处理
 *
 * @author ruoyi
 * @date 2019-12-05
 */
@Service
@Transactional
public class EntityServiceImpl extends ServiceImpl<EntityMapper, Entity> implements IEntityService {
    @Resource
    private EntryMapper entryMapper;

    @Override
    public boolean removeEntity(List<Long> ids) {
        baseMapper.deleteBatchIds(ids);
        for (Long id :
                ids) {
            QueryWrapper<Entry> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("entity_id", id);
            entryMapper.delete(queryWrapper);
        }
        return true;
    }

    public List<Map> listEntryInfo(String userName) {
        return baseMapper.listEntryInfo(userName);
    }
    //查询实体与辅助词
    public List<Map> listEntity(Entity entity){
        return baseMapper.listEntity(entity);
    }
}
